home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d931.lha
/
Modules
/
IntuitionSupport
/
IntuitionDemoII.mod
/
IntuitionDemoII.mod
Wrap
Text File
|
1993-12-20
|
7KB
|
190 lines
MODULE IntuitionDemoII;
(* Dieses Demo veranschaulicht die Benutzung der Menuroutinen aus dem *)
(* Modul IntuitionSupport. Auf diesem Demo liegt kein Copyright! *)
FROM SYSTEM IMPORT ADR,ASSEMBLE;
FROM IntuitionSupport IMPORT CreateSimpleScreen,CreateSimpleWindow,enabled,
AddTextMenuItem,AddTextSubItem,AddMenu,FreeMenu,
InstallMenu,InitMenu,AddPropGadget,ItemFlagSet,
PropGadgetFlagSet,MenuHandlePtr,none,ItemFlags,
DeleteWindow,DeleteScreen,WaitForPossibleAction,
MessageType,GetMenuSelection,stdFont,stdHeight,
AddBarMenuItem,AddBarSubItem,AddImageSubItem,
GetImage,GetColorImage,StartNewColumn,SetXOffset,
SetDefaultAdditionalWidth,SetDefaultMenuFont,
SetMenuFont,StartMutualExclude,EndMutualExclude,
SetDefaultHeight;
FROM Conversions IMPORT ValToStr;
FROM IntuitionD IMPORT ScreenPtr,WindowPtr,IDCMPFlagSet,IDCMPFlags,
WindowFlags,WindowFlagSet,ImagePtr;
FROM GraphicsD IMPORT FontStyleSet,FontStyles,RastPortPtr;
FROM GraphicsL IMPORT SetAPen,Move,Text,Draw;
FROM GfxMacros IMPORT SetDrPt;
PROCEDURE WriteNumbers(rp : RastPortPtr;
n1,n2,n3 : INTEGER);
VAR str : ARRAY[0..7] OF CHAR;
err : BOOLEAN;
BEGIN
ValToStr(n1,TRUE,str,10,3,' ',err);
Text(rp,ADR(str),3);
Text(rp,ADR(", "),1);
ValToStr(n2,TRUE,str,10,3,' ',err);
Text(rp,ADR(str),3);
Text(rp,ADR(", "),1);
ValToStr(n3,TRUE,str,10,3,' ',err);
Text(rp,ADR(str),3);
END WriteNumbers;
(*$ EntryExitCode:=FALSE *)
PROCEDURE LinePatterns;
BEGIN
ASSEMBLE(
DC.W %1111111111111111
DC.W %1010101010101010
DC.W %1111001111001111
DC.W %1111000011110000
DC.W %1100100110010011
END);
END LinePatterns;
VAR scr : ScreenPtr;
win : WindowPtr;
rp : RastPortPtr;
m : MenuHandlePtr;
end : BOOLEAN;
mt : MessageType;
t : INTEGER;
pt : POINTER TO ARRAY[0..4] OF CARDINAL;
lim : ARRAY[0..4] OF ImagePtr;
im,sim : ARRAY[0..15] OF ImagePtr;
idcmp : IDCMPFlagSet;
mnr,inr,snr : INTEGER;
BEGIN
pt:=ADR(LinePatterns);
scr:=CreateSimpleScreen(640,256,4,
ADR("MenuDemo IntuitionSupport © 1992 by Andre Wiethoff"),2);
IF scr#NIL THEN
rp:=ADR(scr^.rastPort);
FOR t:=0 TO 4 DO
SetDrPt(rp,pt^[t]);
Move(rp,0,20);
Draw(rp,40,20);
lim[t]:=GetImage(rp,0,20,32,1,0,0,NIL);
END;
SetDrPt(rp,65535);
win:=CreateSimpleWindow(0,0,640,256,NIL,
WindowFlagSet{activate,borderless,backDrop},scr);
IF win#NIL THEN
m:=InitMenu(win,stdFont,stdHeight,FontStyleSet{});
IF m#NIL THEN
AddMenu(m,"Project",enabled);
AddTextMenuItem(m,"Info",none,"I",ItemFlagSet{invert});
AddBarMenuItem(m);
AddTextMenuItem(m,"Load",none,none,ItemFlagSet{invert});
AddTextSubItem(m,"All",none,"A",ItemFlagSet{invert});
AddBarSubItem(m);
AddTextSubItem(m,"Graphics",none,"G",ItemFlagSet{invert});
AddTextSubItem(m,"Texts",none,"T",ItemFlagSet{invert});
AddTextMenuItem(m,"Save All",none,"S",ItemFlagSet{invert});
AddTextMenuItem(m,"Print",none,"P",ItemFlagSet{invert});
AddBarMenuItem(m);
AddTextMenuItem(m,"Quit ","Really?","Q",ItemFlagSet{});
AddMenu(m,"Edit",enabled);
AddTextMenuItem(m,"Cut",none,"X",ItemFlagSet{box});
AddTextMenuItem(m,"Copy",none,"C",ItemFlagSet{box});
AddTextMenuItem(m,"Insert",none,"V",ItemFlagSet{box});
AddBarMenuItem(m);
AddTextMenuItem(m,"Erase",none,"E",ItemFlagSet{box});
AddMenu(m,"Fonts",enabled);
StartMutualExclude(m);
IF SetMenuFont(m,"topaz",8,FontStyleSet{}) THEN END;
AddTextMenuItem(m,"Topaz 8",none,none,ItemFlagSet{checkset,invert});
IF SetMenuFont(m,"topaz",9,FontStyleSet{}) THEN END;
AddTextMenuItem(m,"Topaz 9",none,none,ItemFlagSet{checkit,invert});
IF SetMenuFont(m,"ruby",15,FontStyleSet{}) THEN END; (* Sorry! *)
AddTextMenuItem(m,"Ruby 15",none,none,ItemFlagSet{checkit,invert});
IF SetMenuFont(m,"sapphire",19,FontStyleSet{}) THEN END;
AddTextMenuItem(m,"Sapphire 19",none,none,ItemFlagSet{checkit,invert});
EndMutualExclude(m);
SetDefaultMenuFont(m);
AddTextMenuItem(m,"...",none,none,ItemFlagSet{disable});
AddBarMenuItem(m);
IF SetMenuFont(m,stdFont,stdHeight,FontStyleSet{underlined}) THEN END;
AddTextMenuItem(m,"Underlined",none,none,ItemFlagSet{checkit,invert});
IF SetMenuFont(m,stdFont,stdHeight,FontStyleSet{bold}) THEN END;
AddTextMenuItem(m,"Bold",none,none,ItemFlagSet{checkit,invert});
IF SetMenuFont(m,stdFont,stdHeight,FontStyleSet{italic}) THEN END;
AddTextMenuItem(m,"Italic",none,none,ItemFlagSet{checkset,invert});
SetDefaultMenuFont(m);
AddMenu(m,"Draw",enabled);
AddTextMenuItem(m,"Colors",none,none,ItemFlagSet{box});
SetDefaultAdditionalWidth(m,4);
SetXOffset(m,2);
FOR t:=0 TO 15 DO
im[t]:=GetColorImage(20,10,0,0,t,NIL);
sim[t]:=GetImage(ADR(scr^.rastPort),t*20,0,20,10,0,0,NIL);
AddImageSubItem(m,im[t],sim[t],none,ItemFlagSet{});
IF t MOD 4=3 THEN
StartNewColumn(m);
END;
END;
AddTextMenuItem(m,"Line Style",none,none,ItemFlagSet{box});
SetDefaultHeight(m,4);
FOR t:=0 TO 4 DO
AddImageSubItem(m,lim[t],NIL,none,ItemFlagSet{invert});
END;
SetDefaultAdditionalWidth(m,24);
SetDefaultHeight(m,2);
SetXOffset(m,0);
AddBarMenuItem(m);
StartMutualExclude(m);
AddTextMenuItem(m,"Draw",none,'D',ItemFlagSet{checkset,invert});
AddTextMenuItem(m,"Line",none,'L',ItemFlagSet{checkit,invert});
AddTextMenuItem(m,"Fill",none,'F',ItemFlagSet{checkit,invert});
EndMutualExclude(m);
SetAPen(rp,1);
Move(rp,10,130);
Text(rp,ADR("Angewähltes Menu : "),19);
IF InstallMenu(m) THEN
end:=FALSE;
REPEAT
mt:=WaitForPossibleAction(win,idcmp);
CASE mt OF
|menuSelected : GetMenuSelection(win,mnr,inr,snr);
Move(rp,162,130);
WriteNumbers(rp,mnr,inr,snr);
IF (mnr=0) AND (inr=6) THEN
end:=TRUE;
END;
ELSE
END;
UNTIL end;
END;
END;
END;
END;
CLOSE
FreeMenu(m);
DeleteWindow(win);
DeleteScreen(scr);
END IntuitionDemoII.